home *** CD-ROM | disk | FTP | other *** search
/ Revolution - Das Atari CD Magazin 1997 / Revolution - Das Atari CD Magazin 1.iso / software / anwendng / qed_397 / sourcen / olga.c < prev    next >
C/C++ Source or Header  |  1996-12-29  |  2KB  |  118 lines

  1. #include "global.h"
  2. #include "comm.h"
  3. #include "olga.h"
  4.  
  5. /* lokale Variablem **********************************************************/
  6. LOCAL WORD        OLGA_id;
  7. LOCAL BOOLEAN    OLGA_Activ;
  8.  
  9.  
  10. /*****************************************************************************/
  11. LOCAL VOID sendOLEinit(VOID)
  12. {
  13.     memset(msgbuff, 0, (WORD)sizeof(msgbuff));
  14.     msgbuff[0] = OLE_INIT;
  15.     msgbuff[1] = gl_apid;
  16.     msgbuff[3] = OL_SERVER;
  17.     msgbuff[7] = 'ED';
  18.     send_msg(OLGA_id);
  19. }
  20.  
  21. LOCAL VOID sendOLEexit(VOID)
  22. {
  23.     memset(msgbuff, 0, (WORD)sizeof(msgbuff));
  24.     msgbuff[0] = OLE_EXIT;
  25.     msgbuff[1] = gl_apid;
  26.     send_msg(OLGA_id);
  27. }
  28.  
  29. LOCAL VOID sendOLGAupdate(UBYTE *filename)
  30. {
  31.     memset(msgbuff, 0, (WORD)sizeof(msgbuff));
  32.     msgbuff[0] = OLGA_UPDATE;
  33.     msgbuff[1] = gl_apid;
  34.     strcpy(global_str1, filename);
  35.     *(UBYTE **)(msgbuff + 3) = global_str1;
  36.     send_msg(OLGA_id);
  37. }
  38.  
  39. LOCAL VOID sendOLGArename(UBYTE *oldname, UBYTE *newname)
  40. {
  41.     memset(msgbuff, 0, (WORD)sizeof(msgbuff));
  42.     msgbuff[0] = OLGA_RENAME;
  43.     msgbuff[1] = gl_apid;
  44.     strcpy(global_str1, oldname);
  45.     *(UBYTE **)(msgbuff + 3) = global_str1;
  46.     strcpy(global_str2, newname);
  47.     *(UBYTE **)(msgbuff + 5) = global_str2;
  48.     send_msg(OLGA_id);
  49. }
  50.  
  51. GLOBAL VOID    hndl_OLGA(WORD *msg)
  52. {
  53.     switch (msg[0])
  54.     {
  55.         case OLGA_INIT :
  56.             OLGA_Activ = TRUE;
  57.             break;
  58.         case OLE_NEW :
  59.             OLGA_id = msg[1];
  60.             sendOLEinit();
  61.             break;
  62.         case OLGA_ACK :
  63.             break;
  64.         case OLE_EXIT :
  65.             OLGA_Activ = FALSE;
  66.             break;
  67.     }
  68. }
  69.  
  70. GLOBAL VOID do_OLGA(WORD flag, UBYTE *name1, UBYTE *name2)
  71. {
  72.     if (OLGA_Activ)
  73.     {
  74.         switch (flag)
  75.         {
  76.             case OLGA_UPDATE :
  77.                 if (name1 != NULL)
  78.                     sendOLGAupdate(name1);
  79.                 break;
  80.             case OLGA_RENAME :
  81.                 if (name1 != NULL && name2 != NULL)
  82.                     sendOLGArename(name1, name2);
  83.                 break;
  84.         }
  85.     }
  86. }
  87.  
  88. GLOBAL VOID init_olga(VOID)
  89. {
  90.     UBYTE    *p;
  91.  
  92.     OLGA_id = appl_find("OLGA    ");
  93.     if (OLGA_id > 0)
  94.         sendOLEinit();
  95.     else
  96.     {
  97.         p = getenv("OLGAMANAGER");
  98.         if (p != NULL)
  99.         {
  100.             PATH    olga_path, olga_name;
  101.  
  102.             strcpy(olga_name, p);
  103.             file_splitt(olga_name, olga_path, NULL);
  104.             set_path(olga_path);
  105.             if (aes41)
  106.                 shel_write(1, 1, 1, olga_name, "");
  107.             else if (magx)
  108.                 shel_write(1, 1, 100, olga_name, "");
  109.         }
  110.     }
  111. }
  112.  
  113. GLOBAL VOID term_olga(VOID)
  114. {
  115.     if (OLGA_Activ)
  116.         sendOLEexit();
  117. }
  118.